package li.kaeppe.travel.tracker.service;

import java.util.Collection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import li.kaeppe.travel.tracker.dao.BlogEntryDao;
import li.kaeppe.travel.tracker.domain.BlogEntry;

public class BlogEntryServiceImpl implements BlogEntryService {

	/* **************************************************** */
	/*                      CONSTANTS                       */
	/* **************************************************** */

	public static final Log log = LogFactory.getLog(BlogEntryServiceImpl.class);
	
	/* **************************************************** */
	/*                     MEMBER FIELDS                    */
	/* **************************************************** */

	private BlogEntryDao blogEntryDao;
	
	/* **************************************************** */
	/*                      CONSTRUCTOR                     */
	/* **************************************************** */

	/* **************************************************** */
	/*                    PUBLIC METHODS                    */
	/* **************************************************** */

	public Collection<BlogEntry> getBlogEntriesByTrip(String tripKey) {
		if(log.isDebugEnabled()) {
			log.debug("BlogEntryServiceImpl -> getBlogEntriesByTrip()");
		}
		return this.getBlogEntryDao().getBlogEntriesByTrip(tripKey);
	}

	public BlogEntry storeBlogEntry(BlogEntry entry) {
		if(log.isDebugEnabled()) {
			log.debug("BlogEntryServiceImpl -> storeBlogEntry()");
		}
		
		this.getBlogEntryDao().storeBlogEntry(entry);
		return entry;
	}
	
	/* **************************************************** */
	/*                  PROTECTED METHODS                   */
	/* **************************************************** */

	/* **************************************************** */
	/*                   PRIVATE METHODS                    */
	/* **************************************************** */

	/* **************************************************** */
	/*                  GETTERS AND SETTERS                 */
	/* **************************************************** */
	
	public BlogEntryDao getBlogEntryDao() {
		return blogEntryDao;
	}

	public void setBlogEntryDao(BlogEntryDao blogEntryDao) {
		this.blogEntryDao = blogEntryDao;
	}
	
}
